<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=latin1">
        <link rel="stylesheet" type="text/css" href="../padrao.css" />
        <link rel="stylesheet" href="../jQuery/lista.css" type="text/css" media="all" />
        <script type="text/javascript" src="../jQuery/jquery-1.2.1.pack.js"></script>
        <script type="text/javascript" src="../jQuery/busca.js"></script>
        <script type="text/javascript" src="../sorttable.js"></script>

        <title> Template </title>

        <script type="text/javascript"  language="Javascript">
            function valida(formulario){
                if(formulario.nome.value == ""){
                    alert("O Nome nao foi preenchida");
                    return false;
                }

                if(formulario.cpf_cnpj.value == ""){
                    alert("O CPF/CNPJ nao foi preenchido");
                    return false;
                }
                return true;
            }

        </script>

        <?php
        ob_start();
        session_start();
        include '../infobox.php';
        include '../verifica_usuario.php';
        include '../functions.php';
        include '../functions_office.php';
        include '../menu.php';
        ?>

    </head>
    <body>
        <div class="conteudo">

            <?php
            
            $nome = $_SESSION[empresa_selecionada_nome];
            echo "nome = $nome<br>";
            getEmpresa_info_complete_by_nome($nome);

            $cpf_cnpj = $_SESSION[empresa_cpf_cnpj];
            $cred_poly = $_SESSION[empresa_cred_poly];
            $cred_truck = $_SESSION[empresa_cred_truck];
            $cred_toco = $_SESSION[empresa_cred_toco];
            $cred_carreta = $_SESSION[empresa_cred_carreta];
            $cred_transbordo = $_SESSION[empresa_cred_transbordo];
            $cadastro_rapido_count = 0;
            $cadastro_rapido_ind = 0;
            $status = $_SESSION[empresa_status];
            $rg = $_SESSION[empresa_rg];
            $emissor = $_SESSION[empresa_emissor];
            $data_nascimento = $_SESSION[empresa_data_nascimento];
            $estado_civil = $_SESSION[empresa_estado_civil];
            $e_mail = $_SESSION[empresa_e_mail];
            $endereco = $_SESSION[empresa_endereco];
            $end_numero = $_SESSION[empresa_end_numero];
            $end_complemento = $_SESSION[empresa_end_complemento];
            $end_bairro = $_SESSION[empresa_end_bairro];
            $end_cidade = $_SESSION[empresa_end_cidade];
            $end_estado = $_SESSION[empresa_end_estado];
            $cep = $_SESSION[empresa_end_cep];
            $ddd_fone1 = $_SESSION[empresa_ddd_fone1];
            $fone1 = $_SESSION[empresa_fone1];
            $ddd_fone2 = $_SESSION[empresa_ddd_fone2];
            $fone2 = $_SESSION[empresa_fone2];
            $contato = $_SESSION[empresa_contato];
            $cargo = $_SESSION[empresa_cargo];
            $inscricao_municipal = $_SESSION[empresa_inscricao_municipal];
            $inscricao_estadual = $_SESSION[empresa_inscricao_estadual];
            $nome_fantasia = $_SESSION[empresa_nome_fantasia];
            $home_page = $_SESSION[empresa_home_page];
            $vale_ind = $_SESSION[empresa_vale_ind];
            $nota_ind = $_SESSION[empresa_nota_ind];
            $pj_ind = $_SESSION[empresa_pj_ind];
            $vale_ind = $_SESSION[empresa_vale_ind];
            $vip_ind = $_SESSION[empresa_vip_ind];
            $preco_especial_ind = $_SESSION[empresa_preco_especial_ind];
            $data_criacao = $_SESSION[empresa_data_criacao];
            $vip_limitado = $_SESSION[empresa_vip_limitado];
            $vip_limitado_count = $_SESSION[empresa_vip_limitado_count];


            $valor_spc_poly = $_SESSION[empresa_valor_spc_poly];
            $valor_spc_truck = $_SESSION[empresa_valor_spc_truck];
            $valor_spc_truck = $_SESSION[empresa_valor_spc_toco];
            $valor_spc_truck = $_SESSION[empresa_valor_spc_carreta];
            $valor_spc_truck = $_SESSION[empresa_valor_spc_transbordo];

            echo "<form method='POST' onsubmit='return valida(this);' action='alterando_empresas.php'>";
            echo "<table>";
            echo "<tr>";
            echo "    <td> Nome:<br> </td>";
            echo "    <td> <input name='nome' type='text' size='20'value='$nome' autocomplete='off'> </td>";
            echo "</tr>";

            //PJ_IND
            //VIP_IND
            echo "<tr>";
            echo "    <td> Pessoa:</td>";
            echo "    <td> <select name='pj_ind' >";
            if ($pj_ind == 1) {
                echo "<option value = juridica > Juridica </option>";
                echo "<option value = fisica > Fisica </option>";
            } else {
                echo "<option value = fisica > Fisica </option>";
                echo "<option value = juridica > Juridica </option>";
            }
            echo "        </select>";
            echo "    </td>";
            echo "</tr>";

            echo "<tr>";
            echo "    <td> CPF/CNPJ: </td>";
            echo "    <td> <input name='cpf_cnpj' type='text' size='20' value='$cpf_cnpj' autocomplete='off'> </td>";
            echo "</tr>";




            //estado civil
            echo "<tr>";
            echo "    <td> Status:</td>";
            echo "    <td> <select name='empresa_status' >";
            if ($status == "banido") {
                echo "<option value = banido > Banido </option>";
                echo "<option value = ok > OK </option>";
                echo "<option value = divida > Divida pendente </option>";
            } else if ($status == "divida") {
                echo "<option value = divida > Divida pendente </option>";
                echo "<option value = ok > OK </option>";
                echo "<option value = banido > Viuvo </option>";
            } else {
                echo "<option value = ok > OK </option>";
                echo "<option value = banido > Banido </option>";
                echo "<option value = divida > Divida pendente </option>";
            }
            echo "        </select>";
            echo "    </td>";
            echo "</tr>";




            echo "<tr>";
            echo "    <td> RG: </td>";
            echo "    <td> <input name='rg' type='text' size='20'value='$rg' autocomplete='off'> </td>";
            echo "</tr>";
            echo "<tr>";
            echo "    <td> Emissor: </td>";
            echo "    <td> <input name='emissor' type='text' size='20'value='$emissor' autocomplete='off'> </td>";
            echo "</tr>";
            echo "<tr>";
            echo "    <td> Data de Nascimento: </td>";
            echo "    <td> <input name='data_nascimento' type='text' size='20'value='$data_nascimento' autocomplete='off'> </td>";
            echo "</tr>";
            //estado civil
            echo "<tr>";
            echo "    <td> Estado Civil:</td>";
            echo "    <td> <select name='estado_civil' >";
            if ($estado_civil == "Solteiro") {
                echo "<option value = solteiro > Solteiro </option>";
                echo "<option value = casado > Casado </option>";
                echo "<option value = viuvo > Viuvo </option>";
                echo "<option value = divorciado > Divorciado </option>";
            } else if ($estado_civil == "Casado") {
                echo "<option value = casado > Casado </option>";
                echo "<option value = solteiro > Solteiro </option>";
                echo "<option value = viuvo > Viuvo </option>";
                echo "<option value = divorciado > Divorciado </option>";
            } else if ($estado_civil == "Viuvo") {
                echo "<option value = viuvo > Viuvo </option>";
                echo "<option value = casado > Casado </option>";
                echo "<option value = solteiro > Solteiro </option>";
                echo "<option value = divorciado > Divorciado </option>";
            } else if ($estado_civil == "Divorciado") {
                echo "<option value = divorciado > Divorciado </option>";
                echo "<option value = casado > Casado </option>";
                echo "<option value = solteiro > Solteiro </option>";
                echo "<option value = viuvo > Viuvo </option>";
            } else {
                echo "<option value = casado > Casado </option>";
                echo "<option value = solteiro > Solteiro </option>";
                echo "<option value = viuvo > Viuvo </option>";
                echo "<option value = divorciado > Divorciado </option>";
            }
            echo "        </select>";
            echo "    </td>";
            echo "</tr>";
            echo "<tr>";
            echo "    <td> Endereço: </td>";
            echo "    <td> <input name='endereco' type='text' size='20' value='$endereco' autocomplete='off'> </td>";
            echo "</tr>";
            echo "<tr>";
            echo "    <td> Numero: </td>";
            echo "    <td> <input name='end_numero' type='text' size='20' value='$end_numero' autocomplete='off'> </td>";
            echo "</tr>";
            echo "<tr>";
            echo "    <td> Complemento: </td>";
            echo "    <td> <input name='end_complemento' type='text' size='20' value='$end_complemento' autocomplete='off'> </td>";
            echo "</tr>";
            echo "<tr>";
            echo "    <td> Bairro: </td>";
            echo "    <td> <input name='end_bairro' type='text' size='20' value='$end_bairro' autocomplete='off'> </td>";
            echo "</tr>";
            echo "<tr>";
            echo "    <td> Cidade: </td>";
            echo "    <td> <input name='end_cidade' type='text' size='20' value='$end_cidade' autocomplete='off'> </td>";
            echo "</tr>";

            //estado
            echo "<tr>";
            echo "    <td> Estado: </td>";
            echo "    <td>";
            echo "<select name='end_estado'>";
            //ACRE
            if ($end_estado == "AC") {
                echo "<option value='AC' selected>AC</option>";
            } else {
                echo "<option value='AC'>AC</option>";
            }
            //ALAGOAS
            if ($end_estado == "AL") {
                echo "<option value='AL' selected>AL</option>";
            } else {
                echo "<option value='AL'>AL</option>";
            }
            //AMAZONAS
            if ($end_estado == "AM") {
                echo "<option value='AM' selected>AM</option>";
            } else {
                echo "<option value='AM'>AM</option>";
            }
            //AMAPA
            if ($end_estado == "AP") {
                echo "<option value='AP' selected>AP</option>";
            } else {
                echo "<option value='AP'>AP</option>";
            }
            //BAHIA
            if ($end_estado == "BA") {
                echo "<option value='BA' selected>BA</option>";
            } else {
                echo "<option value='BA'>BA</option>";
            }
            //CEARA
            if ($end_estado == "CE") {
                echo "<option value='CE' selected>CE</option>";
            } else {
                echo "<option value='CE'>CE</option>";
            }
            //DISTRITO FEDERAL
            if ($end_estado == "DF") {
                echo "<option value='DF' selected>DF</option>";
            } else {
                echo "<option value='DF'>DF</option>";
            }
            //ESPIRITO SANTO
            if ($end_estado == "ES") {
                echo "<option value='ES' selected>ES</option>";
            } else {
                echo "<option value='ES'>ES</option>";
            }
            //GOIAS
            if ($end_estado == "GO") {
                echo "<option value='GO' selected>GO</option>";
            } else {
                echo "<option value='GO'>GO</option>";
            }
            //MARANHAO
            if ($end_estado == "MA") {
                echo "<option value='MA' selected>MA</option>";
            } else {
                echo "<option value='MA'>MA</option>";
            }
            //MINAS GERAIS
            if ($end_estado == "MG") {
                echo "<option value='MG' selected>MG</option>";
            } else {
                echo "<option value='MG'>MG</option>";
            }
            //MATO GROSSO DO SUL
            if ($end_estado == "MS") {
                echo "<option value='MS' selected>MS</option>";
            } else {
                echo "<option value='MS'>MS</option>";
            }
            //MATO GROSSO
            if ($end_estado == "MT") {
                echo "<option value='MT' selected>MT</option>";
            } else {
                echo "<option value='MT'>MT</option>";
            }
            //PARA
            if ($end_estado == "PA") {
                echo "<option value='PA' selected>PA</option>";
            } else {
                echo "<option value='PA'>PA</option>";
            }
            //PARAIBA
            if ($end_estado == "PB") {
                echo "<option value='PB' selected>PB</option>";
            } else {
                echo "<option value='PB'>PB</option>";
            }
            //PERNANBUCO
            if ($end_estado == "PE") {
                echo "<option value='PE' selected>PE</option>";
            } else {
                echo "<option value='PE'>PE</option>";
            }
            //PIAUI
            if ($end_estado == "PI") {
                echo "<option value='PI' selected>PI</option>";
            } else {
                echo "<option value='PI'>PI</option>";
            }
            //PARANA
            if ($end_estado == "PR") {
                echo "<option value='PR' selected>PR</option>";
            } else {
                echo "<option value='PR'>PR</option>";
            }
            //RIO DE JANEIRO
            if ($end_estado == "RJ") {
                echo "<option value='RJ' selected>RJ</option>";
            } else {
                echo "<option value='RJ'>RJ</option>";
            }
            //RIO GRANDE DO NORTE
            if ($end_estado == "RN") {
                echo "<option value='RN' selected>RN</option>";
            } else {
                echo "<option value='RN'>RN</option>";
            }
            //RONDONIA
            if ($end_estado == "RN") {
                echo "<option value='RN' selected>RN</option>";
            } else {
                echo "<option value='RN'>RN</option>";
            }
            //RORAIMA
            if ($end_estado == "RR") {
                echo "<option value='RR' selected>RR</option>";
            } else {
                echo "<option value='RR'>RR</option>";
            }
            //RIO GRANDE DO SUL
            if ($end_estado == "RS") {
                echo "<option value='RS' selected>RS</option>";
            } else {
                echo "<option value='RS'>RS</option>";
            }
            //SANTA CATARINA
            if ($end_estado == "SC") {
                echo "<option value='SC' selected>SC</option>";
            } else {
                echo "<option value='SC'>SC</option>";
            }
            //SERGIPE
            if ($end_estado == "SE") {
                echo "<option value='SE' selected>SE</option>";
            } else {
                echo "<option value='SE'>SE</option>";
            }
            //SP
            if ($end_estado == "SP") {
                echo "<option value='SP' selected>SP</option>";
            } else {
                echo "<option value='SP'>SP</option>";
            }
            //TOCANTINS
            if ($end_estado == "TO") {
                echo "<option value='TO' selected>TO</option>";
            } else {
                echo "<option value='TO'>TO</option>";
            }

            echo"</select>";
            echo "    </td>";
            echo "</tr>";

            ///////////////////////////////

            echo "<tr>";
            echo "    <td> CEP: </td>";
            echo "    <td> <input name='end_cep' type='text' size='20' value='$cep' autocomplete='off'> </td>";
            echo "</tr>";
            echo "<tr>";
            echo "    <td> Fone Comercial: </td>";
            echo "    <td> (<input name='ddd_fone1' type='text' size='2' value='$ddd_fone1' autocomplete='off'>) <input name='fone1' type='text' size='10'value='$fone1' autocomplete='off'> </td>";
            echo "</tr>";
            echo "<tr>";
            echo "    <td> Fone Celular: </td>";
            echo "    <td> (<input name='ddd_fone2' type='text' size='2' value='$ddd_fone2' autocomplete='off'>) <input name='fone2' type='text' size='10'value='$fone2' autocomplete='off'> </td>";
            echo "</tr>";
            echo "<tr>";
            echo "    <td> Contato: </td>";
            echo "    <td> <input name='contato' type='text' size='20' value='$contato' autocomplete='off'> </td>";
            echo "</tr>";
            echo "<tr>";
            echo "    <td> Cargo: </td>";
            echo "    <td> <input name='cargo' type='text' size='20' value='$cargo' autocomplete='off'> </td>";
            echo "</tr>";
            echo "<tr>";
            echo "    <td> Inscrição Municipal: </td>";
            echo "    <td> <input name='inscricao_municipal' type='text' size='20' value='$inscricao_municipal' autocomplete='off'> </td>";
            echo "</tr>";
            echo "<tr>";
            echo "    <td> Inscrição Estadual: </td>";
            echo "    <td> <input name='inscricao_estadual' type='text' size='20' value='$inscricao_estadual' autocomplete='off'> </td>";
            echo "</tr>";
            echo "<tr>";
            echo "    <td> Nome Fantasia: </td>";
            echo "    <td> <input name='nome_fantasia' type='text' size='20' value='$nome_fantasia' autocomplete='off'> </td>";
            echo "</tr>";
            echo "<tr>";
            echo "    <td> E-mail: </td>";
            echo "    <td> <input name='e_mail' type='text' size='20' value='$e_mail' autocomplete='off'> </td>";
            echo "</tr>";
            echo "<tr>";
            echo "    <td> Home Page: </td>";
            echo "    <td> <input name='home_page' type='text' size='20' value='$home_page' autocomplete='off'> </td>";
            echo "</tr>";

            //VALE_IND
            echo "<tr>";
            echo "    <td> Permite vale:</td>";
            echo "    <td> <select name='vale_ind' >";
            if ($vale_ind == 1) {
                echo "<option value = sim > Sim </option>";
                echo "<option value = nao > Nao </option>";
            } else {
                echo "<option value = nao > Nao </option>";
                echo "<option value = sim > Sim </option>";
            }
            echo "        </select>";
            echo "    </td>";
            echo "</tr>";

            //VIP_IND
            echo "<tr>";
            echo "    <td> Vip?</td>";
            echo "    <td> <select name='vip_ind' >";
            if ($vip_ind == 1) {
                echo "<option value = sim > Sim </option>";
                echo "<option value = nao > Nao </option>";
            } else {
                echo "<option value = nao > Nao </option>";
                echo "<option value = sim > Sim </option>";
            }
            echo "        </select>";
            echo "    </td>";
            echo "</tr>";

            //VIP_LIMITADO
            echo "<tr>";
            echo "    <td> Vip limitado?</td>";
            echo "    <td> <select name='vip_limitado' >";
            if ($vip_limitado == 1) {
                echo "<option value = sim > Sim </option>";
                echo "<option value = nao > Nao </option>";
            } else {
                echo "<option value = nao > Nao </option>";
                echo "<option value = sim > Sim </option>";
            }
            echo "        </select>";
            echo "    </td>";
            echo "</tr>";

            echo "<tr>";
            echo "    <td> Limite de viagens permitido: </td>";
            echo "    <td> <input name='vip_limitado_count' type='text' size='20' value='$vip_limitado_count' autocomplete='off'> </td>";
            echo "</tr>";

           

            echo "<tr>";
            echo '<td align="center"> <input value="Salvar" type="submit"> </td>';
            echo "</tr>";
            echo "</table>";
            echo "</form>";
            ?>
        </div>
    </body>
</html>
